home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 3 / ct-rom iiib.zip / ct-rom iiib / WINDOWS / DIVERSEN / WINE02BX / EDEBUG < prev    next >
Text File  |  1993-03-28  |  69KB  |  1,555 lines

  1. Info file edebug, produced by Makeinfo, -*- Text -*- from input file
  2. edebug.texinfo.
  3.  
  4.    This file documents Edebug
  5.  
  6.    This is edition 1.2 of the Edebug User Manual for edebug Version
  7. 2.6,
  8.  
  9.    Copyright (C) 1991 Daniel LaLiberte
  10.  
  11.    Permission is granted to make and distribute verbatim copies of
  12. this manual provided the copyright notice and this permission notice
  13. are preserved on all copies.
  14.  
  15.    Permission is granted to copy and distribute modified versions of
  16. this manual under the conditions for verbatim copying, provided that
  17. the entire resulting derived work is distributed under the terms of a
  18. permission notice identical to this one.
  19.  
  20.    Permission is granted to copy and distribute translations of this
  21. manual into another language, under the above conditions for modified
  22. versions, except that this permission notice may be stated in a
  23. translation approved by the Foundation.
  24.  
  25. 
  26. File: edebug,  Node: Top,  Next: Installation,  Up: (dir)
  27.  
  28. Edebug
  29. ******
  30.  
  31. * Menu:
  32.  
  33. * Installation::        Installation
  34. * Using Edebug::        Using Edebug
  35. * Evaluating defuns::        Evaluating defuns
  36. * Edebug Modes::        Edebug Modes
  37. * Miscellaneous::        Miscellaneous
  38. * Breakpoints::            Breakpoints
  39. * Views::            Views
  40. * Evaluation::            Evaluation
  41. * Printing::            Printing
  42. * The Outside Context::        The Outside Context
  43. * Macro Calls::            Macro Calls
  44. * Options::            Options
  45. * Todo List::            Todo List
  46. * Index::            Index
  47.  
  48.    Edebug is a source level debugger for GNU Emacs Lisp that provides
  49. the following features:
  50.  
  51.    * Step through the evaluation of your functions and macros, stopping
  52.      before and after each expression, displaying the results of
  53.      expressions.
  54.  
  55.    * Set conditional or unconditional breakpoints.
  56.  
  57.    * Go until a breakpoint is reached, or ignore breakpoints.
  58.  
  59.    * Trace slow or fast stopping briefly at each stop point, or each
  60.      breakpoint.
  61.  
  62.    * Evaluate expressions as if outside of edebug.
  63.  
  64.    * Automatically reevaluate a list of expressions and display their
  65.      results each time edebug updates the display.
  66.  
  67.    * Output tracing info on function enter and exit.
  68.  
  69.    * Catch errors normally caught by debug.
  70.  
  71.    * Display backtrace without edebug calls.
  72.  
  73.    * Interface with the `custom-print' package.
  74.  
  75.    It isn't necessary to read all of this document, or even most of
  76. it, in order to make use of edebug.  You should minimally read sections
  77. Installation, Using Edebug, and Edebug Modes; the rest can be read as
  78. needed.
  79.  
  80.    This manual assumes you are familiar with Emacs Lisp, as described
  81. in the GNU Emacs Lisp Reference Manual.  You might want to review the
  82. chapters on Evaluation and Debugging.
  83.  
  84. 
  85. File: edebug,  Node: Installation,  Next: Using Edebug,  Prev: Top,  Up: Top
  86.  
  87. Installation
  88. ============
  89.  
  90.    Put `edebug.el' in some directory in your `load-path' and
  91. byte-compile it.
  92.  
  93.    Put the following forms in your `.emacs' file.
  94.  
  95.      (define-key emacs-lisp-mode-map "\C-xx" 'edebug-defun)
  96.      (autoload 'edebug-defun "edebug")
  97.  
  98.    If you wish to change the default edebug global command prefix,
  99. include the following.
  100.  
  101.      (setq edebug-global-prefix "\C-xX") ; or whatever you want
  102.  
  103. 
  104. File: edebug,  Node: Using Edebug,  Next: Evaluating defuns,  Prev: Installation,  Up: Top
  105.  
  106. Using Edebug
  107. ============
  108.  
  109.    To use edebug you must be editing an Emacs Lisp buffer using
  110. `emacs-lisp-mode', or its equivalent, since the Emacs Lisp syntax
  111. table must be present.
  112.  
  113.    The following commands are described in this section.
  114.  
  115. `C-xx'
  116.      (`edebug-defun') Evaluates the function or macro at or after point
  117.      setting it up for use by edebug.  Unlike `eval-defun' it always
  118.      prints `edebug: NAME' in the minibuffer and a prefix argument has
  119.      a different effect as described below.  If a syntax error is
  120.      found, point is left at the error and mark is set to the original
  121.      point.
  122.  
  123. `?'
  124.      (`edebug-help') Display the help message for `edebug-mode'.
  125.  
  126. `a'
  127.      (`abort-recursive-edit') Abort the edebug recursive edit.  This
  128.      only aborts one level as opposed to all the way to the top level.
  129.  
  130. `q'
  131.      (`top-level') Exit all recursive editing levels to the top level
  132.      command loop.
  133.  
  134. `r'
  135.      (`edebug-previous-result') Redisplay the result of the previous
  136.      expression in the echo area.
  137.  
  138.    To use edebug, simply evaluate a `defun' or `defmacro' with
  139. `edebug-defun' (`C-xx') when the point is in or before the definition.
  140.   The next time your function or macro is called, edebug will be
  141. called.  From now on, discussion about using edebug with functions
  142. includes macros, unless otherwise specified.  Like `eval-defun',
  143. `edebug-defun' evaluates function definitions, but adds edebug calls
  144. to the lambda expression.
  145.  
  146.    To restore a function to normal operation after the definition has
  147. been evaluated with `edebug-defun', simply reevaluate it with one of
  148. the commands that evaluate definitions (e.g., `eval-defun' (`M-C-x'),
  149. `eval-current-buffer', or if the buffer is unchanged, `load-library').
  150.  However, the behavior of most of these evaluating functions can also
  151. be modified by edebug, as described in *Note Evaluating defuns::.
  152.  
  153.    Implementation note:  Recall that a `defun' is the source code
  154. definition of a function and evaluation of a definition puts the lambda
  155. expression for the function in the function cell of the symbol naming
  156. the function.  After evaluating a `defun' with `edebug-defun', the
  157. lambda expression stored in the function symbol's function cell
  158. contains a call to the function `edebug-enter' at the top level and
  159. individual calls to the function `edebug-before' and `edebug-after'
  160. for each expression that may be evaluated in the function.
  161.  
  162.    When you call your function explicitly or via another function,
  163. edebug will be called, but it may or may not stop execution depending
  164. on what the current edebug mode is.  Some edebug modes only update the
  165. display to indicate the progress of the evaluation without stopping
  166. execution.  The default initial edebug mode is `step' which does stop
  167. execution.  The edebug modes are described in detail below (*note
  168. Edebug Modes::.).
  169.  
  170.    Each time edebug updates the display to indicate the progress of the
  171. evaluation, the buffer that the function is defined in is displayed
  172. temporarily.  Also point is moved (temporarily) to the expression in
  173. the function about to be evaluated (or just evaluated) and an overlay
  174. arrow is displayed at the left end of the line containing point.  If
  175. the point is not visible in the window, the window start is changed
  176. (semi-permanently!) so that point is visible, while trying to display
  177. as much of the following code as possible.  See *Note The Outside
  178. Context:: for more details on how the Emacs display is affected by
  179. edebug.
  180.  
  181.    In the example below, the definition of the `fac' function has been
  182. evaluated with `edebug-defun' (by positioning point within the
  183. definition and hitting `C-xx') and the expression `(fac 3)' has been
  184. evaluated.  The arrow on the first line indicates that edebug has been
  185. entered.  To indicate that you are stopped before the first
  186. expression, the cursor would be on the first left parenthesis of that
  187. line.
  188.  
  189.      (defun fac (n)
  190.      =>(if (< 0 n)
  191.            (* n (fac (1- n)))
  192.          1))
  193.  
  194.    When execution is stopped, you are "in edebug" in a recursive edit
  195. with point in the buffer defining the function, as described above. 
  196. This buffer, called the "edebug buffer", is made read-only and the
  197. `edebug-mode' minor mode is activated.  Several commands are available
  198. in addition to the standard `emacs-lisp-mode' bindings.  Try the `?'
  199. command (`edebug-help') for a list of edebug commands.  From the
  200. edebug recursive edit, you are permitted to call functions that invoke
  201. edebug again recursively.  At any time in edebug, you can quit to the
  202. top level with `q' (`top-level)' or abort one recursive edit level
  203. with `a' (`abort-recursive-edit').
  204.  
  205.    Places within a function that edebug may stop, called "stop points",
  206. are before and after expressions that are not self-evaluating, i.e.
  207. list forms and symbols.  However, edebug does not stop before symbols
  208. (i.e., variables) unless `edebug-stop-before-symbols' is non-`nil',
  209. since it is not usually useful to do so.  When stopped after an
  210. expression, edebug displays the result of the expression in the
  211. minibuffer.  Use the `r' command (`edebug-previous-result') to see
  212. that result again.  You can control the way in which expression
  213. results are printed by using the `custom-print' package (*note
  214. Printing::.).
  215.  
  216.    Edebug knows about all the special forms, interactive forms with
  217. expressions, anonymous lambda expressions, and embedded `defun' or
  218. `defmacro' calls.  It cannot know what a macro will do with the
  219. arguments of a macro call so you must tell it; *note Macro Calls::. for
  220. the details.  You can use the same mechanism to tell edebug that some
  221. function arguments should be functions.
  222.  
  223.    Continuing the example of the `fac' function, the user may step
  224. through the execution of the function (with SPC) stopping in edebug at
  225. the stop points which are marked with a period:
  226.  
  227.      (defun fac (n)
  228.      =>.(if .(< 0 n.).
  229.            .(* n. .(fac (1- n.).).).
  230.          1).)
  231.  
  232.    Whenever a function evaluated with `edebug-defun' is active, the
  233. Emacs debugger named by the variable `debugger' is set to
  234. `edebug-debug', so it is not necessary to set it yourself.  (Currently
  235. there is no option to turn off this feature.)  If an error occurs and
  236. `debug-on-error' is non-`nil', edebug will display the error and move
  237. point to the last known stop point.  This applies to quit signals too,
  238. if `debug-on-quit' is non-`nil'.  But in any case, if no function that
  239. was evaluated with `edebug-defun' is currently active, `debug' is run
  240. normally.  Note that you can also get a full backtrace inside of
  241. edebug (see *Note Miscellaneous::).
  242.  
  243. 
  244. File: edebug,  Node: Evaluating defuns,  Next: Edebug Modes,  Prev: Using Edebug,  Up: Top
  245.  
  246. Evaluating defuns
  247. =================
  248.  
  249.    There are a couple other ways to evaluate a `defun' for edebug
  250. besides calling `edebug-defun' directly.  The variable
  251. `edebug-all-defuns' affects the behavior of several commands defined
  252. by Emacs.  `eval-defun' (`M-C-x') is redefined by `edebug.el' to use
  253. `edebug-defun' if `edebug-all-defuns' is non-`nil', or alternatively,
  254. if you supply a prefix argument.  But if `edebug-all-defuns' is
  255. non-`nil' and you also supply a prefix argument, `edebug-defun' will
  256. not be used.  In other words, the prefix argument of `eval-defun'
  257. reverses the effect of `edebug-all-defuns'.  The default value of
  258. `edebug-all-defuns' is `nil'.  Call the function `edebug-all-defuns'
  259. to toggle the value of the variable `edebug-all-defuns'.
  260.  
  261.    Note that this version of `eval-defun' evaluates whatever top level
  262. form it finds, as it normally does, but only `defun's (and
  263. `defmacro's) are evaluated with `edebug-defun'.
  264.  
  265.    `eval-region' is redefined to use `edebug-defun' when evaluating
  266. `defun's (if `edebug-all-defuns' is non-`nil').  The prefix argument
  267. for `eval-region' has the normal behavior since it is used by other
  268. functions (including the standard functions `eval-defun',
  269. `eval-print-last-sexp', and `eval-last-sexp').  If an error occurs
  270. during the evaluation, point is left after the expression in error. 
  271. Also, this `eval-region' does not use `narrow-to-region' to limit the
  272. scope of evaluation, and consequently there is a small difference in
  273. how white space is handled after an expression when the output is
  274. inserted in the buffer.
  275.  
  276.    `eval-current-buffer' is redefined to use `eval-region', since the
  277. standard version does not, thus gaining all the benefits of the new
  278. `eval-region'.
  279.  
  280.    Note that loading does not invoke `edebug-defun', since the load
  281. functions are subroutines that use the internal `eval-region' rather
  282. than the redefined one supplied by `edebug.el'.  This could be
  283. considered a feature since loading a file does not also visit the file
  284. which would be necessary if edebug were to be invoked on one of the
  285. functions defined in the file.
  286.  
  287.    See *Note Evaluation:: for discussion of other evaluation functions
  288. available inside of edebug.
  289.  
  290. 
  291. File: edebug,  Node: Edebug Modes,  Next: Miscellaneous,  Prev: Evaluating defuns,  Up: Top
  292.  
  293. Edebug Modes
  294. ============
  295.  
  296.    While your function is being evaluated, edebug is in one of several
  297. modes.  The current mode is called the "edebug mode", not to be
  298. confused with major or minor modes.  The current edebug mode determines
  299. how edebug displays the progress of the evaluation, whether it stops at
  300. each stop point, or continues to the next breakpoint, for example.
  301.  
  302.    Each time you enter edebug, you will be in the same mode you
  303. specified the previous time you were in edebug.  The exception is when
  304. edebug is first entered for each recursive edit level; then the mode
  305. is changed to the value in the global variable `edebug-initial-mode',
  306. which defaults to "step" mode.  In the case of a command where the
  307. `interactive' form has an expression argument, the expression is
  308. evaluated before the function is really entered, so the edebug mode
  309. defaults to `edebug-initial-mode' both for this expression and for the
  310. first expression in the function body.  (In fact, this repeated
  311. resetting to the initial mode also occurs each time your function is
  312. called non-recursively before returning to the command level which
  313. invoked the function.)
  314.  
  315.    Below is a table of the keys which change the edebug mode.  For each
  316. key, the mode is set and the recursive edit is exited; what happens
  317. next depends on which mode you selected, which code your function
  318. executes, and whether a breakpoint is hit.  You can also set the edebug
  319. mode when edebug is not running (or in a non-edebug buffer) by hitting
  320. `C-xX' (default value of `edebug-global-prefix') followed by the same
  321. key as used inside of edebug.  Most of the other edebug commands are
  322. available in the same manner.
  323.  
  324. `SPC'
  325.      (`edebug-step-through') Step mode stops at the next stop point
  326.      encountered.
  327.  
  328. `t'
  329.      (`edebug-trace') Trace mode pauses one second at each edebug stop
  330.      point.
  331.  
  332. `T'
  333.      (`edebug-Trace-fast') Trace with zero pause time at each stop
  334.      point.
  335.  
  336. `c'
  337.      (`edebug-continue') Continue after pausing for one second at each
  338.      breakpoint.
  339.  
  340. `C'
  341.      (`edebug-Continue-fast') Continue with zero pause time at each
  342.      breakpoint.
  343.  
  344. `g'
  345.      (`edebug-go') Go until a breakpoint.  *Note Breakpoints::.
  346.  
  347. `G'
  348.      (`edebug-Go-nonstop') Go non-stop ignoring breakpoints.  This is
  349.      the fastest way to execute code that has edebug calls in it, but
  350.      this mode of execution is still interruptible; see below.
  351.  
  352. `S'
  353.      (`edebug-stop') Stop executing at the first stop point
  354.      encountered, regardless of the mode.  This command does not
  355.      change the mode and does not continue execution; it is intended
  356.      to be used to interrupt execution.
  357.  
  358.    To execute edebugged code more rapidly, use commands farther down
  359. in the list.  For example, Go-nonstop mode is alot faster that trace
  360. mode since it ignores breakpoints.  The continue modes do not stop at
  361. breakpoints, but merely pause at them.
  362.  
  363.    While executing or tracing, you can interrupt the execution by
  364. hitting one of the edebug command characters, at which time the
  365. command is acted on.  For example, hitting SPC will stop execution at
  366. the first stop point because input is pending, but will then step to
  367. the next stop point.  Alternatively, `S' is bound to `edebug-stop'
  368. which does nothing but stop.  If your function happens to read input,
  369. a character you hit intending to interrupt execution may be read by
  370. the function instead, so be careful in the neighborhood of the read
  371. call.  Also see the discussion of errors and quit signals in *Note
  372. Using Edebug::.
  373.  
  374.    Keyboard macros invoked within edebug will not work across edebug
  375. calls, so you must enter each edebug command separately.  (It doesn't
  376. seem worth it to save and restore keyboard macro definitions and
  377. executions between calls to edebug in such a way that it doesn't
  378. affect any outside command processing, and it may not be possible in
  379. any case.)
  380.  
  381. 
  382. File: edebug,  Node: Miscellaneous,  Next: Breakpoints,  Prev: Edebug Modes,  Up: Top
  383.  
  384. Miscellaneous
  385. =============
  386.  
  387.    Some miscellaneous commands are described here.
  388.  
  389. `f'
  390.      (`edebug-forward-sexp') Proceed from the current point to the sexp
  391.      found by first doing `forward-sexp' and then switching to go mode. 
  392.      If a prefix argument is supplied, do `forward-sexp' that many
  393.      times.  If there are not enough sexps for `forward-sexp', call
  394.      `edebug-step-out' instead.  Be careful that the sexp found by
  395.      `forward-exp' will be executed; this will not always be the case
  396.      in a `condition-case', for example.  A temporary breakpoint is
  397.      set at the stop point, so it will be used and cleared whenever
  398.      execution reaches it.  See *Note Breakpoints:: for the details on
  399.      breakpoints.
  400.  
  401.      Notice that we do the `forward-sexp' starting at the current point
  402.      rather than the stop point, thus providing more flexibility.  If
  403.      you want to start the search at the stop point, first do
  404.      `edebug-where' (`w').
  405.  
  406. `o'
  407.      (`edebug-step-out') Proceed from the current point to the end of
  408.      the containing sexp.  If the containing sexp is the top level
  409.      defun, go to the end of the last sexp instead, or if that is the
  410.      same point, then step out of the function.  Therefore this
  411.      command does not exit the currently executing function unless you
  412.      are positioned after the last sexp of the function.
  413.  
  414.      Like `edebug-forward-sexp', this command switches to go mode to
  415.      get to the containing sexp.  The only situation in which the
  416.      containing sexp will not be reached by edebug is if a non-local
  417.      exit by-passes it.
  418.  
  419. `i'
  420.      (`edebug-step-in') Step into the function about to be called.  Use
  421.      this command before any of the arguments of the function call are
  422.      evaluated since otherwise it will be too late.  One side effect
  423.      of using `edebug-step-in' is that the next time the stepped-into
  424.      function is called, edebug will be called there as well.  (I may
  425.      try to fix this in the future.)
  426.  
  427. `h'
  428.      (`edebug-goto-here') Proceed to the stop point near the current
  429.      point.  A temporary breakpoint is used.  See *Note Breakpoints::
  430.      for details on how the stop point is found.
  431.  
  432. `d'
  433.      (`edebug-backtrace') A `debug'-like backtrace is displayed.  All
  434.      calls to edebug functions are removed to clean up the display. 
  435.      This backtrace does not function like the standard backtrace so
  436.      you cannot specify which frames to stop at, etc. - but it is
  437.      better than nothing.  The backtrace buffer is killed
  438.      automatically when you continue execution.
  439.  
  440. 
  441. File: edebug,  Node: Breakpoints,  Next: Views,  Prev: Miscellaneous,  Up: Top
  442.  
  443. Breakpoints
  444. ===========
  445.  
  446.    The purpose of "breakpoints" is to let you specify significant
  447. places in your code where you would like edebug to stop or pause
  448. execution.  Breakpoints may be set at any stop points as defined in
  449. *Note Using Edebug::, even before symbols.  Edebug will stop or pause
  450. at a breakpoint except when the edebug mode is Go-nonstop.  For
  451. setting and unsetting breakpoints, the stop point that is affected is
  452. at or after the current point.  The following commands are related to
  453. breakpoints:
  454.  
  455. `b'
  456.      (`edebug-set-breakpoint') Set a breakpoint at the stop point at
  457.      or after the current point.  With prefix-arg, the breakpoint is
  458.      temporary.
  459.  
  460. `u'
  461.      (`edebug-unset-breakpoint') Unset or clear a breakpoint at the
  462.      stop point at or after the current point.
  463.  
  464. `x'
  465.      (`edebug-set-conditional-breakpoint') Set a conditional
  466.      breakpoint.  You are asked for the conditional expression.  With
  467.      prefix-arg, the breakpoint is temporary.
  468.  
  469. `B'
  470.      (`edebug-next-breakpoint') Move point to the next breakpoint in
  471.      the current function definition.
  472.  
  473.    While in edebug, you can set a breakpoint with `b'
  474. (`edebug-set-breakpoint') and unset (or clear) it with `u'
  475. (`edebug-unset-breakpoint').  First move point to a position at or
  476. before the desired edebug stop point, then hit the key to change the
  477. breakpoint.  Unsetting a breakpoint that has not been set does nothing.
  478.  
  479.    Reevaluating the defun with `edebug-defun' clears all breakpoints
  480. in the function.  (Let me know if you would like breakpoints preserved;
  481. I could use marks for breakpoints instead of relying on the offsets
  482. from the beginning of the defun.)
  483.  
  484.    A "conditional breakpoint" is set with `x'
  485. (`edebug-set-conditional-breakpoint').  When you set a conditional
  486. breakpoint you will be asked for an expression which is evaluated each
  487. time the breakpoint is reached.  Edebug will only stop at a conditional
  488. breakpoint if the condition evaluates to non-`nil'.  But conditional
  489. breakpoints are not even checked if the edebug mode is Go-nonstop.
  490.  
  491.    For both conditional and unconditional breakpoints, the breakpoint
  492. can be made into a "temporary breakpoint" if you give a prefix arg to
  493. the command.  After breaking at a temporary breakpoint, it is
  494. automatically cleared.
  495.  
  496.    To find out where your breakpoints are, use the `B'
  497. (`edebug-next-breakpoint') command which moves point to the next
  498. breakpoint in the function following point, or to the first breakpoint
  499. if there are no following breakpoints.  (Note that this command does
  500. not continue execution - it just moves the point.)
  501.  
  502. 
  503. File: edebug,  Node: Views,  Next: Evaluation,  Prev: Breakpoints,  Up: Top
  504.  
  505. Views
  506. =====
  507.  
  508.    If the function you are debugging modifies the Emacs window
  509. environment, you may wish to check the "outside window configuration"
  510. as it was before edebug was called, since edebug itself also modifies
  511. the window environment (see *Note Outside Window Configuration:: for
  512. how edebug tries to restore it). The following commands relate to
  513. views in general.
  514.  
  515. `v'
  516.      (`edebug-view-outside') View the outside window configuration.
  517.  
  518. `p'
  519.      (`edebug-bounce-point') Bounce to the point in the outside current
  520.      buffer, and return after one second.
  521.  
  522. `w'
  523.      (`edebug-where') Move point back to the current stop point.
  524.  
  525. `W'
  526.      (`edebug-toggle-save-windows') Toggle the `edebug-save-windows'
  527.      variable.  Each time you toggle it, the inside and outside window
  528.      configurations become the same as the current configuration.  By
  529.      turning this off and on again, edebug thereafter restores the
  530.      outside window configuration to the current configuration.
  531.  
  532.    You can view the outside window configuration with `v'
  533. (`edebug-view-outside') or bounce to the current point in the current
  534. buffer with `p' (`edebug-bounce-point'), even if it is not normally
  535. displayed.  After moving point or changing buffers, you may wish to
  536. pop back to the stop point with `w' (`edebug-where') from an edebug
  537. window or `C-xXw' in any window.
  538.  
  539. 
  540. File: edebug,  Node: Evaluation,  Next: Printing,  Prev: Views,  Up: Top
  541.  
  542. Evaluation
  543. ==========
  544.  
  545.    This section describes commands related to the explicit and
  546. automatic evaluation of expressions in edebug.  Edebug attempts to
  547. make such evaluations while inside of edebug appear that they are
  548. occuring outside of edebug, as if edebug had not been invoked.  Almost
  549. everything about the outside context is restored (*note The Outside
  550. Context::. for the details).  But `M-ESC' (`eval-expression') still
  551. evaluates expressions normally (in the current context) since that is
  552. occasionally needed.  Also supported is an evaluation list window
  553. where expressions may be evaluated interactively or automatically.
  554.  
  555.    You can control the way in which expression results are printed by
  556. using the `custom-print' package (*note Printing::.).
  557.  
  558. `e'
  559.      (`edebug-eval-expression') Evaluates an expression in the
  560.      "outside context" of your function, rather than in the edebug
  561.      context as `M-ESC' does.  (These commands are therefore
  562.      consistent with the same commands in the standard debugger.)
  563.  
  564. `C-xC-e'
  565.      (`edebug-eval-last-sexp') Like `eval-last-sexp' except in the
  566.      outside context.
  567.  
  568. `E'
  569.      (`edebug-visit-eval-list') Jump to an evaluation list window in
  570.      which several other commands apply, described below.  The
  571.      evaluation list is reevaluated each time the edebug display is
  572.      updated (including tracing) and the results are displayed in a
  573.      temporary buffer `*edebug*'.
  574.  
  575.    The following commands apply to the evaluation list which is
  576. displayed in the `*edebug*' buffer.  All the `lisp-interaction-mode'
  577. commands are also available.
  578.  
  579. `LFD'
  580.      (`edebug-eval-print-last-sexp') Similar to `eval-print-last-sexp'
  581.      but in the outside context.
  582.  
  583. `C-xC-e'
  584.      (`edebug-eval-last-sexp') Similar to `eval-last-sexp' but in the
  585.      outside context.
  586.  
  587. `C-cC-u'
  588.      (`edebug-update-eval-list') Build a new evaluation list from the
  589.      first expression of each group, reevaluate and redisplay.  Groups
  590.      are separated by a line starting with a comment.
  591.  
  592. `C-cC-d'
  593.      (`edebug-delete-eval-item') Delete the evaluation list group that
  594.      point is in.
  595.  
  596. `C-cC-w'
  597.      (`edebug-where') Jump back to the edebug buffer at the current
  598.      stop point.
  599.  
  600.    In the evaluation list window, type in expressions and evaluate them
  601. with `LFD' (`edebug-eval-print-last-sexp') or `C-xC-e'
  602. (`edebug-eval-last-sexp'), just as you would for lisp interaction mode
  603. but the evaluation is done in the outside context.  (Note:
  604. `eval-region' is not redefined to evaluate in the outside context; it
  605. is only redefined to use `edebug-defun' when it encounters a defun -
  606. see *Note Evaluating defuns::.)
  607.  
  608.    The expressions you enter interactively, and their results, will be
  609. lost when you continue execution of your function unless you add them
  610. to the evaluation list.  To add any number of expressions to the
  611. evaluation list use `C-cC-u' (`edebug-update-eval-list').  This builds
  612. a new list from the first expression of each "group", where groups are
  613. separated by a line starting with a comment.
  614.  
  615.    When the evaluation list is redisplayed, each expression is
  616. displayed followed by the result of evaluating it, and a comment line.
  617.  If an error occurs during an evaluation, the error message is
  618. displayed in a string as if it were the result.  Therefore expressions
  619. that use undefined variables will not interrupt your debugging.  Here
  620. is an example of what the evaluation list window looks like after
  621. several expressions have been added to it.
  622.  
  623.      (current-buffer)
  624.      #<buffer *scratch*>
  625.      ;---------------------------------------------------------------
  626.      (point-min)
  627.      1
  628.      ;---------------------------------------------------------------
  629.      (point-max)
  630.      2
  631.      ;---------------------------------------------------------------
  632.      edebug-outside-point-max
  633.      "Symbol's value as variable is void: edebug-outside-point-max"
  634.      ;---------------------------------------------------------------
  635.      (recursion-depth)
  636.      0
  637.      ;---------------------------------------------------------------
  638.      this-command
  639.      eval-last-sexp
  640.      ;---------------------------------------------------------------
  641.  
  642.    You can delete the group that point is positioned in with `C-cC-d'
  643. (`edebug-delete-eval-item'), or use normal editing commands to modify
  644. the text as much as you want (e.g. delete-region).  Be sure to update
  645. the evaluation list with `C-cC-u' before you continue evaluation of
  646. your function or quit to the top level, unless you want your changes
  647. to be lost.  Also be sure to separate each "group" with a comment
  648. before updating, otherwise the wrong expressions may end up in the
  649. list.
  650.  
  651.    You can return to the source code buffer (the edebug buffer) with
  652. `C-cC-w' which is equivalent to `C-xXw'.  The `*edebug*' buffer is
  653. killed when you continue execution of your function, and recreated
  654. next time it is needed.
  655.  
  656.    If you are concerned with exactly how the evaluation is done, you
  657. may need to know that the evaluation of expressions occurs in one of
  658. two slightly different outside contexts.  If the evaluation list is
  659. non-empty when edebug is entered, the context used to evaluate it is
  660. closest to the true outside context since nothing much has changed when
  661. the evaluation is done.  However, when you evaluate expressions within
  662. edebug using the above described interactive commands or when you
  663. update the evaluation list, as much of the outside context is restored
  664. as possible, but not everything (*note The Outside Context::.).  One
  665. way to observe the difference is to look at the `recursion-depth'.
  666.  
  667. 
  668. File: edebug,  Node: Printing,  Next: The Outside Context,  Prev: Evaluation,  Up: Top
  669.  
  670. Printing
  671. ========
  672.  
  673.    If the results of your expressions contain circular references to
  674. other parts of the same structure, the standard Emacs print
  675. subroutines may fail to print with an error, "Apparently circular
  676. structure being printed".  If you only use cdr circular lists (where
  677. cdrs of lists point back; what is the right term here?), you can limit
  678. the length of printing with `print-length' and edebug does this for
  679. you when printing out the previous result.  But car circular lists and
  680. circular vectors generate the above mentioned untrappable error in
  681. Emacs version 18.  Version 19 will support `print-level', but it is
  682. often useful to get a better print representation of circular
  683. structures.
  684.  
  685.    To handle printing of structures more generally, you can use the
  686. `custom-print' package which supports `print-level', `print-circle',
  687. and further customizations via `custom-print-list' and
  688. `custom-print-vector'.  See the documentation strings of these
  689. variables for more details.  There are two main ways to use this
  690. package.  First, you may replace `prin1', `princ', and some
  691. subroutines that use them by calling `install-custom-print-funcs' so
  692. that any use of these functions in lisp code will be affected. 
  693. Second, you could call the custom routines directly, thus only
  694. affecting the printing that requires them.  Edebug uses the second
  695. method, as described next.
  696.  
  697.    To load the package and activate custom printing only for edebug,
  698. simply use the command `edebug-install-custom-print-funcs'.  This sets
  699. the function cells of `edebug-prin1', `edebug-print',
  700. `edebug-prin1-to-string', and `edebug-format' to the symbol names of
  701. the corresponding custom versions.  Therefore, any changes you make to
  702. the custom functions or to the variables controlling custom printing
  703. take effect immediately.  Notice you still need to set `print-level'
  704. or `print-circle'.  To restore the standard print functions, use
  705. `edebug-reset-print-funcs'.
  706.  
  707. 
  708. File: edebug,  Node: The Outside Context,  Next: Macro Calls,  Prev: Printing,  Up: Top
  709.  
  710. The Outside Context
  711. ===================
  712.  
  713.    This section is useful for those who need to know more precisely
  714. what edebug is doing that might affect editing and the context of
  715. expression evaluation.  For the most part, edebug operates
  716. transparently and there should be no apparent difference running with
  717. edebug, except for debugging itself.  If you find any variation with
  718. what is described here, please let me know.
  719.  
  720.    An important distinction is made between the "outside context" which
  721. exists before edebug is invoked, and the "inside context" which exists
  722. while edebug is active.  Most of the outside context is saved and
  723. restored each time you enter and exit from edebug.  In addition, most
  724. evaluations you do within edebug (see *Note Evaluation::) occur in the
  725. same outside context which is temporarily restored for the evaluation.
  726.  
  727.    Described in this section are the aspects of the outside context
  728. that are saved and restored including things as diverse as window
  729. configurations, current buffer status, and variable values.  These
  730. aspects are divided into three sections, corresponding to the degree to
  731. which edebug has affected the outside context.  The first section,
  732. immediately following this, is for those things that are affected any
  733. time edebug is called even if the display is not updated.  The second
  734. section is for when edebug must update the display.  The third section
  735. is for when edebug stops execution and enters a recursive edit. 
  736. Finally, the few unavoidable side effects of using edebug are
  737. described.
  738.  
  739. * Menu:
  740.  
  741. * Just Checking::        Just Checking
  742. * Outside Window Configuration::  Outside Window Configuration
  743. * Recursive Edit::        Recursive Edit
  744. * Side Effects::        Side Effects
  745.  
  746. 
  747. File: edebug,  Node: Just Checking,  Next: Outside Window Configuration,  Prev: The Outside Context,  Up: The Outside Context
  748.  
  749. Just Checking
  750. -------------
  751.  
  752.    The following are saved and restored when edebug is called even if
  753. the display is not updated.  One reason there is anything at all to
  754. save and restore is that the call to `edebug-enter' must remain active
  755. while your function is active, and this impacts the Lisp stack.  The
  756. other reason is that execution may be interrupted at any time unless
  757. the edebug mode is Go-nonstop, but an executing keyboard macro should
  758. not interrupt execution.
  759.  
  760.    * `max-lisp-eval-depth' and `max-specpdl-size' are both incremented
  761.      for each `edebug-enter' call so that your code should not be
  762.      impacted by edebug frames on the stack.  I believe they are
  763.      incremented too much currently, but that is better than not
  764.      enough.
  765.  
  766.    * A keyboard macro executed outside of edebug should not affect the
  767.      operation of edebug.  Other input will be caught by edebug,
  768.      however, interrupting execution as described in *Note Edebug
  769.      Modes::.  If you are defining a keyboard macro when edebug is
  770.      entered, all your command input will be included in the macro,
  771.      but this is not much use since the macro will not be executed the
  772.      same way.  I don't know if it is safe to suspend definition of a
  773.      kbd-macro, or if it is useful to allow execution of a macro to
  774.      continue into edebug.  Let me know if you figure this out.
  775.  
  776. 
  777. File: edebug,  Node: Outside Window Configuration,  Next: Recursive Edit,  Prev: Just Checking,  Up: The Outside Context
  778.  
  779. Outside Window Configuration
  780. ----------------------------
  781.  
  782.    One important aspect of the outside context is the "outside window
  783. configuration".  A full description of window configurations may be
  784. found in the GNU Emacs Lisp Reference Manual.  If you are running
  785. `epoch', the concept of a window configuration is generalized to
  786. include the set of current screens, though if you create or destroy
  787. screens while in edebug, this effect will not be reversed.
  788.  
  789.    When you exit from edebug (each time you continue execution, in
  790. fact), the window configuration outside of edebug is restored to what
  791. it was before edebug was entered.  But since Emacs delays screen
  792. update until needed, if you then reenter edebug before a screen update
  793. is required, it will appear that you never left; that is, the outside
  794. window configuration will not be displayed even though it was in
  795. effect.  If your function completes normally, the outside window
  796. configuration will finally be displayed when you return to the command
  797. level, or any time a screen update is forced by some other means (e.g.
  798. `sit-for').
  799.  
  800.    The window configuration, as defined by Emacs, does not include
  801. which buffer is current or where point and mark are in the current
  802. buffer, but edebug saves and restores these also.  Note that the
  803. outside window configuration restored by edebug may not be fully
  804. consistent with the real outside context since the selected window may
  805. not yet have been displayed but edebug may have forced screen update.
  806.  
  807.    If the display needs to be updated by edebug, e.g. a trace mode is
  808. active, the following are saved and restored.  However, if an error or
  809. quit signal occurs, some of these are intensionally not restored for
  810. user convenience.
  811.  
  812.    * The point of the edebug buffer (the one containing the function
  813.      definition) is saved and restored only if the outside current
  814.      buffer is the same as the edebug buffer.  (The point is also not
  815.      restored on error or quit.)
  816.  
  817.    * The outside window configuration, as described above, is saved and
  818.      restored if `edebug-save-windows' is non-`nil'.  These are not
  819.      restored on error or quit, but the outside selected window is
  820.      reselected even on error or quit in case a `save-excursion' is
  821.      active.  The window start for the edebug buffer is not restored,
  822.      however, so that the next time it is displayed, the window start
  823.      will be in the same position it was last time.
  824.  
  825.    * The current buffer, and point and mark in the current buffer are
  826.      normally saved and restored even if the current buffer is the
  827.      same as the edebug buffer.  They are not restored on error or
  828.      quit, but in that event the current buffer will be changed to the
  829.      outside selected window's buffer when you return to the command
  830.      loop, as it normally is.
  831.  
  832.    * The points of all displayed buffers are saved and restored if
  833.      `edebug-save-displayed-buffer-points' is non-`nil'.  See the
  834.      description of that variable for more details.
  835.  
  836.    * The `overlay-arrow-position' and `overlay-arrow-string' are saved
  837.      and restored.  Since edebug uses these variables, saving and
  838.      restoring also permits recursive use of edebug, or other uses of
  839.      the overlay arrow by the outside context.
  840.  
  841.    * `cursor-in-echo-area' is locally bound to `nil' so that the
  842.      cursor shows up in the window.
  843.  
  844. 
  845. File: edebug,  Node: Recursive Edit,  Next: Side Effects,  Prev: Outside Window Configuration,  Up: The Outside Context
  846.  
  847. Recursive Edit
  848. --------------
  849.  
  850.    If edebug stops execution and enters a recursive-edit, the following
  851. additional things are saved and restored.
  852.  
  853.    * The read-only status of the edebug buffer, since edebug changes
  854.      it to read-only.
  855.  
  856.    * The current match data, for whichever buffer was current.  Note
  857.      that Emacs 18.56 partially fixed a bug in `match-data' so that it
  858.      works better with `string-search'.
  859.  
  860.    * The local keymap of the edebug buffer.
  861.  
  862.    * `last-command', `this-command', `last-command-char', and
  863.      `last-input-char'.  Commands within the recursive edit will not
  864.      affect these variables outside of edebug.
  865.  
  866.      But note that the result of `(this-command-keys)' and the value of
  867.      `unread-command-char' cannot be protected, as described below.
  868.  
  869.    * `standard-output' and `standard-input'.  `recursive-edit' locally
  870.      binds these to the default `nil' values (correct??).
  871.  
  872. 
  873. File: edebug,  Node: Side Effects,  Prev: Recursive Edit,  Up: The Outside Context
  874.  
  875. Side Effects
  876. ------------
  877.  
  878.    Many other things may be changed by the user explicitly while in the
  879. edebug recursive edit if they are not protected against change as
  880. described above, and this may be considered a feature in most cases. 
  881. However, some possibly undesirable side effects of using edebug remain,
  882. most of which are unavoidable:
  883.  
  884.    * Changes to the text of buffers are not undone.
  885.  
  886.    * Lisp stack usage is increased, but the limits,
  887.      `max-lisp-eval-depth' and `max-specpdl-size', are also increased
  888.      proportionally.
  889.  
  890.    * The key sequence returned by `this-command-keys' is changed by
  891.      executing commands within edebug and there appears to be no way
  892.      to reset the key sequence from Lisp.
  893.  
  894.    * `unread-command-char' is not protected because its value appears
  895.      to be used even before the command loop is entered by a recursive
  896.      edit.  Thus storing a char in `unread-command-char' always causes
  897.      it to be used for a command in edebug.  I don't know of a
  898.      work-around.
  899.  
  900.    * Complex commands executed while in edebug are added to the
  901.      `command-history'.  This is probably recoverable, but I havent
  902.      investigated it yet.
  903.  
  904.    * When you update the evaluation window, the recursion depth will
  905.      appear one deeper than the outside context recursion depth.
  906.  
  907.    * Horizontal scrolling of the edebug buffer is not recovered.  This
  908.      is probably recoverable, but I havent investigated it yet.
  909.  
  910.    * If you discover others, please let me know.
  911.  
  912. 
  913. File: edebug,  Node: Macro Calls,  Next: Options,  Prev: The Outside Context,  Up: Top
  914.  
  915. Macro Calls
  916. ===========
  917.  
  918.    This section describes a mechanism you may use to tell edebug how
  919. the arguments of macro calls should be evaluated.  The same mechanism
  920. may be used for special forms and some function calls.
  921.  
  922.    To edebug your macro calls, you must specify how the arguments may
  923. be evaluated.  In the general case, not all macro arguments will be
  924. evaluated.  But if it so happens that all your macro arguments are
  925. "evaluatable" (i.e. they may eventually be evaluated either explicitly
  926. in the macro body or when the resulting expansion is evaluated), then
  927. you can set the `edebug-eval-macro-args' option to non-`nil'.  On the
  928. other hand, if you don't want any of your macro arguments to be
  929. evaluated by edebug then you can ensure they will not be wrapped in
  930. edebug calls by setting `edebug-eval-macro-args' to `nil' (the
  931. default).
  932.  
  933.    In the more likely case that some macro arguments are to remain
  934. unevaluated (e.g. a symbol) and some may be evaluated, you can specify
  935. an `edebug-form-spec' for each macro.  Implementation note: edebug
  936. uses `edebug-form-spec's for special forms and some function calls as
  937. well as macro calls.  You can do the same, but there is not really
  938. much point, except for functions that take function arguments.
  939.  
  940.    Use the macro `def-edebug-form-spec' to define a specification for
  941. a function or macro which is stored in the `edebug-form-spec' property
  942. of the symbol naming the function or macro.  The first argument is the
  943. symbol name and the second argument is the specification which may be
  944. one of five kinds of values.  First, if a specification for a symbol
  945. is `nil' or undefined, then depending on the value of
  946. `edebug-eval-macro-args', all the arguments will be treated as
  947. evaluatable (if it's non-`nil') or unevaluatable (if it's `nil').
  948.  
  949.    If the specification is a quoted function (symbol or lambda
  950. expression), then this function is called to process the arguments of
  951. the calling form.
  952.  
  953.    As a convenience, `def-edebug-form-spec' may be given `t' or `0' as
  954. its second argument.  If it is `t', then all arguments are treated as
  955. evaluatable; if it is `0' (not `nil'), then all arguments are treated
  956. as unevaluateable.  Implementation note: these values are actually
  957. converted by `def-edebug-form-spec' to the functions `edebug-forms'
  958. and `edebug-sexps' respectively.
  959.  
  960.    Finally, if the `edebug-form-spec' is a list, then the elements of
  961. the list describe the types of the arguments of a calling form.  The
  962. list is processed left to right, in the same order as the arguments of
  963. the calling form, and the elements constrain the types of corresponding
  964. arguments and specify whether they may be evaluated.  Each element may
  965. be one of the following:
  966.  
  967. `symbolp'
  968.      An unevaluated symbol.
  969.  
  970. `integerp'
  971.      An unevaluated number.
  972.  
  973. `stringp'
  974.      An unevaluated string.
  975.  
  976. `vectorp'
  977.      An unevaluated vector.
  978.  
  979. `atom'
  980.      An unevaluated number, string, symbol, or vector.
  981.  
  982. `sexp'
  983.      An unevaluated sexp (atom or list); the argument may be `nil' or
  984.      `()' but it must not be missing.
  985.  
  986. `form'
  987.      An evaluated sexp.
  988.  
  989. `function'
  990.      A function argument may be a quoted (using quote or function)
  991.      symbol or lambda expression or a form (that should evaluate to a
  992.      function or lambda expression).  The body of an anonymous
  993.      function will be treated as evaluateable.
  994.  
  995. `OTHER'
  996.      Any other symbol should be the name of a function; this function
  997.      is called on the argument as a predicate, and an error is
  998.      signaled if the predicate fails.  You could use this to check
  999.      whether a literal is of a certain custom type.
  1000.  
  1001. `(...)'
  1002.      A sublist of the same format as the top level, processed
  1003.      recursively.  The actual argument must be a list as well. 
  1004.      Special case: if the car of the element is quote, the actual
  1005.      argument must match the quoted sexp, usually a symbol (see
  1006.      example of `for' macro below).
  1007.  
  1008. `[...]'
  1009.      A sublist of the same format as the top level, processed
  1010.      recursively.  It is processed like `(...)' except the matched
  1011.      arguments are inserted in-line into the arguments matched by the
  1012.      containing list, somewhat analogous to `@,' in backquoted
  1013.      expressions.  This may be used for grouping to build complex
  1014.      elements out of the primitives provided.
  1015.  
  1016. `&optional'
  1017.      All following elements in the specification list at this level
  1018.      may or may not match arguments; as soon as one does not match,
  1019.      processing of the specification list terminates.  To get only one
  1020.      specification item to be optional, use `[...]'.
  1021.  
  1022. `&rest'
  1023.      All following elements in the specification list at this level are
  1024.      repeated in order zero or more times.  Allowing more than one
  1025.      `&rest' element is an extension of the normal meaning of &rest. 
  1026.      All the `&rest' elements need not be used in every repetition,
  1027.      however.  Only one `&rest' may appear at the same level of a
  1028.      specification list, and `&rest' must not be followed by
  1029.      `&optional'.  To specify that only some types arguments are to be
  1030.      repeated until failure, followed by some other types of
  1031.      arguments, use `[...]'.
  1032.  
  1033. `&or'
  1034.      Each of the following elements in the specification list at this
  1035.      level are alternatives, processed left to right until one
  1036.      succeeds.  To group two or more list elements as one alternative,
  1037.      bracket them in `[...]'.  Only one `&or' may appear in a list,
  1038.      and it may not be followed by `&optional' or `&rest'.  One of the
  1039.      alternatives must match, unless the `&or' is preceeded by
  1040.      `&optional' or `&rest'.
  1041.  
  1042.    If a failure to match occurs, this does not necessarily mean a
  1043. syntax error will be signalled; instead, "backtracking" will take place
  1044. until all alternatives have been exhausted.  `&optional' elements need
  1045. not match at all of course, but evenually every element of the
  1046. argument list must be matched or an error will be signalled. 
  1047. Non-optional elements in the specification unused when the argument
  1048. list has been completely matched will also cause backtracking, or
  1049. ultimately a syntax error.
  1050.  
  1051.    The combination of backtracking, `&optional', `&rest', `&or', and
  1052. `[...]' for grouping provides the equivalent of regular expressions. 
  1053. The `(...)' lists require balanced parentheses, which is the only
  1054. context free (finite state with stack) construct supported.  Dotted
  1055. pair notation is not yet supported, but let me know if you need it.
  1056.  
  1057.    I am considering writing a compiler for `edebug-form-spec' list
  1058. forms that would generate elisp code to process arguments the same way
  1059. `edebug-interpret-form-spec' now does it but alot faster.  Suggestions
  1060. appreciated.
  1061.  
  1062.    Here are some examples of using `edebug-form-spec'.  A `let' form
  1063. looks like: `(let (BINDINGS ...) FORMS ...)', where each of the
  1064. BINDINGS is either a SYMBOL or `(SYMBOL VALUE-FORM)'.  The
  1065. `edebug-form-spec' for a `let' form is defined as follows:
  1066.  
  1067.      (def-edebug-form-spec let
  1068.        '((&rest
  1069.          &or symbolp (symbolp &optional form))
  1070.         &rest form))
  1071.  
  1072.    A `for' loop macro is defined in the GNU Emacs Lisp Reference
  1073. Manual (reference needed), and `cl.el' defines `case' and `do' macros.
  1074.  Here are their edebug-form-specs.
  1075.  
  1076.      (def-edebug-form-spec for
  1077.        '(symbolp 'from form 'to form 'do &rest form))
  1078.      
  1079.      (def-edebug-form-spec case
  1080.        '(form &rest (sexp form)))
  1081.      
  1082.      (def-edebug-form-spec do
  1083.        '((&rest &or symbolp (symbolp &optional form form))
  1084.          (form &rest form)
  1085.          &rest body))
  1086.  
  1087.    Finally, the functions `mapcar', `mapconcat', `mapatoms', `apply',
  1088. and `funcall' all take function arguments, and edebug defines
  1089. specifications like the following one for `apply'.
  1090.  
  1091.      (def-edebug-form-spec apply '(function &rest form))
  1092.  
  1093.    Note that backquote (``') is a macro that results in an expression
  1094. that is not necessarily evaluated.  It is often used to simplify the
  1095. definition of a macro where the result of the macro call is evaluated,
  1096. but edebug does not know when this is the case.  So do not be surprised
  1097. when you cannot step through your backquoted code.  23 On the other
  1098. hand, one could wrap the backquoted expression in a special function,
  1099. say `edebug-`', which would mean that the result of the backquote form
  1100. will, in fact, be evaluated.  Then edebug could wrap evaluateable
  1101. expressions within the backquoted expression in edebug calls.  Is it
  1102. worth it?
  1103.  
  1104. 
  1105. File: edebug,  Node: Options,  Next: Todo List,  Prev: Macro Calls,  Up: Top
  1106.  
  1107. Options
  1108. =======
  1109.  
  1110.  * User Option: edebug-all-defuns
  1111.      Default `nil'.  If non-`nil', all `defuns' and `defmacros'
  1112.      evaluated will use edebug.  `eval-defun' without prefix arg and
  1113.      `eval-region' will use `edebug-defun'.
  1114.  
  1115.      If `nil', `eval-region' evaluates normally, but `eval-defun' with
  1116.      prefix arg uses `edebug-defun'.  `eval-region' is called by
  1117.      `eval-defun', `eval-last-sexp', and `eval-print-last-sexp'.
  1118.  
  1119.      You may wish to make this variable local to each elisp buffer by
  1120.      calling `(make-local-variable 'edebug-all-defuns)' in your
  1121.      `emacs-lisp-mode-hook'.  You can use the function
  1122.      `edebug-all-defuns' to toggle its value.
  1123.  
  1124.  * User Option: edebug-eval-macro-args
  1125.      Default `nil'.  If non-`nil', edebug will assume that all macro
  1126.      call arguments for macros that have no `edebug-form-spec' may be
  1127.      evaluated, otherwise it will not.  To specify exceptions for
  1128.      macros that have some arguments evaluated and some not, you
  1129.      should specify an `edebug-form-spec' (*note Macro Calls::.).
  1130.  
  1131.  * User Option: edebug-stop-before-symbols
  1132.      Default `nil'.  Non-`nil' causes edebug to stop before symbols as
  1133.      well as after.  This option is used when the `edebug-defun' is
  1134.      called, not when edebugging, so set the option before using
  1135.      `edebug-defun'.
  1136.  
  1137.  * User Option: edebug-save-windows
  1138.      Default `t'.  If non-`nil', save and restore window configuration
  1139.      on edebug calls.  It takes some time to save and restore, so if
  1140.      your program does not care what happens to the window
  1141.      configurations, it is better to set this variable to `nil'.
  1142.  
  1143.  * User Option: edebug-save-point
  1144.      Default `t'.  If non-`nil', save and restore the point and mark
  1145.      in source code buffers.
  1146.  
  1147.  * User Option: edebug-save-displayed-buffer-points
  1148.      Default `nil'.  If non-`nil', save and restore the points of all
  1149.      buffers, displayed or not.
  1150.  
  1151.      Saving and restoring buffer points is necessary if you are
  1152.      debugging code that changes the point of a buffer which is
  1153.      displayed in a non-selected window.  If edebug or the user then
  1154.      selects the window, the buffer's point will be changed to the
  1155.      window's point.
  1156.  
  1157.      Saving and restoring is an expensive operation since it visits
  1158.      each window and each displayed buffer twice for each edebug call,
  1159.      so it is best to avoid it if you can.
  1160.  
  1161.  * User Option: edebug-initial-mode
  1162.      Default `'step'.  Global initial mode for edebug, if non-`nil'. 
  1163.      This is used when edebug is first entered for each recursive-edit
  1164.      level.  Possible values are `nil' (meaning use the current
  1165.      edebug-mode), `'step', `'go', `'Go-nonstop', `'trace',
  1166.      `'Trace-fast', `'continue', and `'Continue-fast'.
  1167.  
  1168.  * User Option: edebug-trace
  1169.      Default `nil'.  Non-`nil' if edebug should show a trace of
  1170.      function entry and exit.  Tracing output is displayed in a buffer
  1171.      named `*edebug-trace*', one function entry or exit per line,
  1172.      indented by the recursion level.  You can customize by replacing
  1173.      functions `edebug-print-trace-entry' and
  1174.      `edebug-print-trace-exit'.
  1175.  
  1176. 
  1177. File: edebug,  Node: Todo List,  Prev: Options,  Up: Top
  1178.  
  1179. Todo List
  1180. =========
  1181.  
  1182.    Send me your suggestions and priorities.
  1183.  
  1184.    If you are interested in running edebug on functions in edebug.el,
  1185. I find it easiest to first copy edebug.el into another file, say
  1186. fdebug.el, and replace all strings "edebug" with "fdebug", then
  1187. evaluate the fdebug buffer and run edebug on functions in fdebug.el.
  1188.  
  1189.    * Bug: Occasionally, your elisp buffer will remain read-only after
  1190.      quitting.  This is mostly an annoyance, but certainly should be
  1191.      fixed.     *Let me know if you can see it - I don't see it any
  1192.      more. *
  1193.  
  1194.    * Bug: I've noticed that the point of some buffers was reset to the
  1195.      point of some other buffer, but I haven't been able to repeat it
  1196.      so perhaps it is fixed.
  1197.  
  1198.    * Bug: "(" in the first column of doc strings messes up
  1199.      `eval-current-buffer', and perhaps others.
  1200.  
  1201.    * Bug: Some legal token streams are still not processed correctly by
  1202.      `edebug-defun'.  For now, be sure there is a space before `'' and
  1203.      don't use `""' inside strings.
  1204.  
  1205.    * There are no other known bugs, so if you find any, please let me
  1206.      know.  There is nothing worse than a buggy debugger!
  1207.  
  1208.    * Let me know if you find any side effects that could or should be
  1209.      avoided.  Also *note Side Effects::..
  1210.  
  1211.    * Figure out how `max-lisp-eval-depth' and `max-specpdl-size'
  1212.      should be set.
  1213.  
  1214.    * Remember the window configuration inside debugger between edebug
  1215.      calls and remember original configuration on the first call to
  1216.      edebug after an interactive command at a lower level.
  1217.  
  1218.    * Make edebug work with selective display - dont stop in hidden
  1219.      lines.
  1220.  
  1221.    * Handle top-level expressions (i.e. outside of defs).  Store
  1222.      offsets in buffer-local variable?
  1223.  
  1224.    * Debug just one or selected subexpressions of a defun - the rest is
  1225.      evalled normally.
  1226.  
  1227.    * Should `overlay-arrow-position' and `-string' be buffer local?
  1228.  
  1229.    * Explicit calls to edebug in user code?
  1230.  
  1231.    * Use copy of `current-local-map' instead of `emacs-lisp-mode-map'
  1232.      (but only copy the first time after lower level command - to save
  1233.      time).
  1234.  
  1235.    * Better integration with standard debug.
  1236.  
  1237.    * Use `inhibit-quit' while edebugging?
  1238.  
  1239.    * Crawl mode would `sit-for' 0 or 1 in the outside window
  1240.      configuration   between each edebug step.    Maybe it should be a
  1241.      separate option that applies to trace as well.
  1242.  
  1243.    * Customizable `sit-for' time.  Less than a second would be nice.
  1244.  
  1245.    * Counting conditions - stop after n iterations.  You can do it
  1246.      manually now with conditional breakpoints.
  1247.  
  1248.    * minibuffer trace - show the current source line in the minibuffer
  1249.      instead of moving point to the expression.
  1250.  
  1251.    * Performance monitoring - summarize trace data.
  1252.  
  1253.    * Speed up edebug-defun and edebugging - always.
  1254.  
  1255.    * Preserve breakpoints between edebug-defun compilations?
  1256.  
  1257.    * Backquote could be handled better, but with difficulty.
  1258.  
  1259.    * Step into code not previously evaluated with `edebug-defun'. 
  1260.      Restore to no edebug version after having entered.  Partially
  1261.      implemented with `i' command.
  1262.  
  1263.    * Optionally replace expressions with results in a separate buffer
  1264.      from the source code.  This idea is based on discussions with
  1265.      Carl Witty regarding his stepper debugger.  Also, unparse code
  1266.      into its own buffer if source code is not available, or if user
  1267.      wishes to use replace-with-results mode.
  1268.  
  1269.    * Preserve previous bindings of local variables, and allow user to
  1270.      jump back to previous frames, particularly binding frames (i.e.
  1271.      `let', `condition-case', function and macro calls) to view values
  1272.      at that frame.  What about buffer local variables?  This is very
  1273.      complex, and it would be better to have access to the Lisp stack.
  1274.  
  1275.    * Variables display, like the evaluation list but automatically
  1276.      display all local variable values.
  1277.  
  1278. 
  1279. File: edebug,  Node: Index,  Prev: Top,  Up: Top
  1280.  
  1281. Index
  1282. *****
  1283.  
  1284. * Menu:
  1285.  
  1286. * &optional:                            Macro Calls.
  1287. * &or:                                  Macro Calls.
  1288. * &rest:                                Macro Calls.
  1289. * *edebug* buffer:                      Evaluation.
  1290. * *edebug-trace*:                       Options.
  1291. * .emacs:                               Installation.
  1292. * ?:                                    Using Edebug.
  1293. * B:                                    Breakpoints.
  1294. * C:                                    Edebug Modes.
  1295. * C-cC-d:                               Evaluation.
  1296. * C-cC-u:                               Evaluation.
  1297. * C-cC-w:                               Evaluation.
  1298. * C-xC-e:                               Evaluation.
  1299. * C-xC-e:                               Evaluation.
  1300. * C-xx:                                 Using Edebug.
  1301. * E:                                    Evaluation.
  1302. * G:                                    Edebug Modes.
  1303. * LFD:                                  Evaluation.
  1304. * S:                                    Edebug Modes.
  1305. * SPC:                                  Edebug Modes.
  1306. * T:                                    Edebug Modes.
  1307. * W:                                    Views.
  1308. * `:                                    Macro Calls.
  1309. * a:                                    Using Edebug.
  1310. * abort-recursive-edit:                 Using Edebug.
  1311. * anonymous lambda expressions:         Using Edebug.
  1312. * autoloading edebug:                   Installation.
  1313. * b:                                    Breakpoints.
  1314. * backquote:                            Macro Calls.
  1315. * backtracking:                         Macro Calls.
  1316. * blink current buffer:                 Views.
  1317. * breakpoints:                          Breakpoints.
  1318. * buffer point:                         Todo List.
  1319. * c:                                    Edebug Modes.
  1320. * calling edebug recursively:           Using Edebug.
  1321. * clearing breakpoints:                 Breakpoints.
  1322. * command-history:                      Side Effects.
  1323. * conditional breakpoints:              Breakpoints.
  1324. * continue fast mode:                   Edebug Modes.
  1325. * continue mode:                        Edebug Modes.
  1326. * counting conditions:                  Todo List.
  1327. * current buffer point and mark:        Outside Window Configuration.
  1328. * cursor-in-echo-area:                  Outside Window Configuration.
  1329. * d:                                    Miscellaneous.
  1330. * debug-on-error:                       Using Edebug.
  1331. * debug-on-quit:                        Using Edebug.
  1332. * debugger:                             Using Edebug.
  1333. * debugging edebug:                     Todo List.
  1334. * def-edebug-form-spec:                 Macro Calls.
  1335. * defmacro:                             Using Edebug.
  1336. * defun:                                Using Edebug.
  1337. * displayed buffer points:              Outside Window Configuration.
  1338. * dotted pair notation:                 Macro Calls.
  1339. * e:                                    Evaluation.
  1340. * edebug:                               Using Edebug.
  1341. * edebug buffer:                        Using Edebug.
  1342. * edebug display update:                Outside Window Configuration.
  1343. * edebug initialization:                Installation.
  1344. * edebug installation:                  Installation.
  1345. * edebug modes:                         Edebug Modes.
  1346. * edebug recursive edit:                Using Edebug.
  1347. * edebug-Continue-fast:                 Edebug Modes.
  1348. * edebug-Go-nonstop:                    Edebug Modes.
  1349. * edebug-Trace-fast:                    Edebug Modes.
  1350. * edebug-all-defuns:                    Evaluating defuns.
  1351. * edebug-all-defuns:                    Options.
  1352. * edebug-all-defuns:                    Evaluating defuns.
  1353. * edebug-backtrace:                     Miscellaneous.
  1354. * edebug-bounce-point:                  Views.
  1355. * edebug-continue:                      Edebug Modes.
  1356. * edebug-defun:                         Using Edebug.
  1357. * edebug-delete-eval-item:              Evaluation.
  1358. * edebug-enter:                         Using Edebug.
  1359. * edebug-eval-expression:               Evaluation.
  1360. * edebug-eval-last-sexp:                Evaluation.
  1361. * edebug-eval-last-sexp:                Evaluation.
  1362. * edebug-eval-macro-args:               Macro Calls.
  1363. * edebug-eval-macro-args:               Options.
  1364. * edebug-eval-print-last-sexp:          Evaluation.
  1365. * edebug-form-spec:                     Macro Calls.
  1366. * edebug-forward-sexp:                  Miscellaneous.
  1367. * edebug-global-prefix:                 Edebug Modes.
  1368. * edebug-go:                            Edebug Modes.
  1369. * edebug-goto-here:                     Miscellaneous.
  1370. * edebug-help:                          Using Edebug.
  1371. * edebug-initial-mode:                  Options.
  1372. * edebug-initial-mode:                  Edebug Modes.
  1373. * edebug-mode:                          Using Edebug.
  1374. * edebug-next-breakpoint:               Breakpoints.
  1375. * edebug-previous-result:               Using Edebug.
  1376. * edebug-print-trace-entry:             Options.
  1377. * edebug-print-trace-exit:              Options.
  1378. * edebug-save-displayed-buffer-points:  Options.
  1379. * edebug-save-displayed-buffer-points:  Outside Window Configuration.
  1380. * edebug-save-point:                    Options.
  1381. * edebug-save-windows:                  Options.
  1382. * edebug-save-windows:                  Outside Window Configuration.
  1383. * edebug-set-breakpoint:                Breakpoints.
  1384. * edebug-set-conditional-breakpoint:    Breakpoints.
  1385. * edebug-step-in:                       Miscellaneous.
  1386. * edebug-step-out:                      Miscellaneous.
  1387. * edebug-step-through:                  Edebug Modes.
  1388. * edebug-stop:                          Edebug Modes.
  1389. * edebug-stop-before-symbols:           Options.
  1390. * edebug-stop-before-symbols:           Using Edebug.
  1391. * edebug-toggle-save-windows:           Views.
  1392. * edebug-trace:                         Options.
  1393. * edebug-trace:                         Edebug Modes.
  1394. * edebug-unset-breakpoint:              Breakpoints.
  1395. * edebug-update-eval-list:              Evaluation.
  1396. * edebug-view-outside:                  Views.
  1397. * edebug-visit-eval-list:               Evaluation.
  1398. * edebug-where:                         Views.
  1399. * edebug-where:                         Evaluation.
  1400. * edebug.el:                            Installation.
  1401. * emacs lisp stack frames:              Just Checking.
  1402. * emacs screen display update:          Outside Window Configuration.
  1403. * emacs-lisp-mode:                      Using Edebug.
  1404. * embedded defun and defmacro:          Using Edebug.
  1405. * entering functions:                   Miscellaneous.
  1406. * epoch screens:                        Outside Window Configuration.
  1407. * error or quit:                        Outside Window Configuration.
  1408. * eval-current-buffer:                  Todo List.
  1409. * eval-current-buffer:                  Using Edebug.
  1410. * eval-current-buffer:                  Evaluating defuns.
  1411. * eval-defun:                           Using Edebug.
  1412. * eval-defun:                           Evaluating defuns.
  1413. * eval-expression:                      Evaluation.
  1414. * eval-last-sexp:                       Evaluating defuns.
  1415. * eval-print-last-sexp:                 Evaluating defuns.
  1416. * eval-region:                          Evaluating defuns.
  1417. * evaluate in outside context:          Evaluation.
  1418. * evaluation:                           Evaluation.
  1419. * evaluation defuns:                    Evaluating defuns.
  1420. * evaluation list group:                Evaluation.
  1421. * evaluation list window:               Evaluation.
  1422. * exiting functions:                    Miscellaneous.
  1423. * f:                                    Miscellaneous.
  1424. * function call:                        Using Edebug.
  1425. * function cell:                        Using Edebug.
  1426. * function symbol:                      Macro Calls.
  1427. * g:                                    Edebug Modes.
  1428. * go mode:                              Edebug Modes.
  1429. * go nonstop mode:                      Edebug Modes.
  1430. * h:                                    Miscellaneous.
  1431. * i:                                    Miscellaneous.
  1432. * ignore breakpoints:                   Edebug Modes.
  1433. * in edebug:                            Using Edebug.
  1434. * inhibit-quit:                         Todo List.
  1435. * input pending:                        Edebug Modes.
  1436. * inside context:                       The Outside Context.
  1437. * interactive expression argument:      Edebug Modes.
  1438. * interactive forms:                    Using Edebug.
  1439. * interrupting execution:               Edebug Modes.
  1440. * keyboard macros:                      Edebug Modes.
  1441. * keyboard macros:                      Just Checking.
  1442. * lambda expression:                    Using Edebug.
  1443. * lambda expression:                    Macro Calls.
  1444. * last-command:                         Recursive Edit.
  1445. * last-command-char:                    Recursive Edit.
  1446. * last-input-char:                      Recursive Edit.
  1447. * lisp stack:                           Side Effects.
  1448. * lisp-interaction-mode:                Evaluation.
  1449. * load-library:                         Using Edebug.
  1450. * load-path:                            Installation.
  1451. * loading:                              Evaluating defuns.
  1452. * local keymap of edebug buffer:        Recursive Edit.
  1453. * local variables:                      Todo List.
  1454. * macro call argument types:            Macro Calls.
  1455. * macro calls:                          Macro Calls.
  1456. * match data of current buffer:         Recursive Edit.
  1457. * max-lisp-eval-depth:                  Todo List.
  1458. * max-lisp-eval-depth:                  Side Effects.
  1459. * max-lisp-eval-depth:                  Just Checking.
  1460. * max-specpdl-size:                     Just Checking.
  1461. * max-specpdl-size:                     Side Effects.
  1462. * max-specpdl-size:                     Todo List.
  1463. * minibuffer:                           Todo List.
  1464. * move to stop point:                   Views.
  1465. * moving overlay arrow:                 Using Edebug.
  1466. * moving point:                         Using Edebug.
  1467. * moving window start:                  Using Edebug.
  1468. * narrow-to-region:                     Evaluating defuns.
  1469. * o:                                    Miscellaneous.
  1470. * options:                              Options.
  1471. * outside context:                      The Outside Context.
  1472. * outside context for evaluation:       Evaluation.
  1473. * outside window configuration:         Outside Window Configuration.
  1474. * outside window configuration:         Views.
  1475. * overlay-arrow-position:               Outside Window Configuration.
  1476. * overlay-arrow-string:                 Outside Window Configuration.
  1477. * p:                                    Views.
  1478. * pause:                                Edebug Modes.
  1479. * performance monitoring:               Todo List.
  1480. * point in edebug buffer:               Outside Window Configuration.
  1481. * preserve breakpoints:                 Todo List.
  1482. * q:                                    Using Edebug.
  1483. * read sexp:                            Todo List.
  1484. * read-only:                            Using Edebug.
  1485. * read-only bug:                        Todo List.
  1486. * read-only edebug buffer:              Recursive Edit.
  1487. * reading input:                        Edebug Modes.
  1488. * recursion depth:                      Side Effects.
  1489. * recursive-edit:                       Recursive Edit.
  1490. * replace with results:                 Todo List.
  1491. * save-excursion:                       Outside Window Configuration.
  1492. * saving and restoring:                 Just Checking.
  1493. * selective display:                    Todo List.
  1494. * side effects:                         Todo List.
  1495. * side effects:                         Side Effects.
  1496. * sit-for:                              Todo List.
  1497. * sit-for:                              Outside Window Configuration.
  1498. * special forms:                        Using Edebug.
  1499. * standard-input:                       Recursive Edit.
  1500. * standard-output:                      Recursive Edit.
  1501. * step mode:                            Edebug Modes.
  1502. * stop execution:                       Edebug Modes.
  1503. * stop points:                          Using Edebug.
  1504. * symbols:                              Using Edebug.
  1505. * syntax error:                         Macro Calls.
  1506. * syntax error:                         Using Edebug.
  1507. * t:                                    Edebug Modes.
  1508. * temporary breakpoints:                Breakpoints.
  1509. * text changes:                         Side Effects.
  1510. * this-command:                         Recursive Edit.
  1511. * this-command-keys:                    Side Effects.
  1512. * this-command-keys:                    Recursive Edit.
  1513. * top-level:                            Using Edebug.
  1514. * top-level expressions:                Todo List.
  1515. * trace fast mode:                      Edebug Modes.
  1516. * trace mode:                           Edebug Modes.
  1517. * tracing function entry and exit:      Options.
  1518. * u:                                    Breakpoints.
  1519. * unread-command-char:                  Recursive Edit.
  1520. * unread-command-char:                  Side Effects.
  1521. * using edebug:                         Using Edebug.
  1522. * v:                                    Views.
  1523. * variables display:                    Todo List.
  1524. * views:                                Views.
  1525. * w:                                    Views.
  1526. * window configuration:                 Outside Window Configuration.
  1527. * window start of edebug buffer:        Outside Window Configuration.
  1528. * x:                                    Using Edebug.
  1529. * x:                                    Breakpoints.
  1530.  
  1531.  
  1532. 
  1533. Tag Table:
  1534. Node: Top892
  1535. Node: Installation2605
  1536. Node: Using Edebug3098
  1537. Node: Evaluating defuns9734
  1538. Node: Edebug Modes12019
  1539. Node: Miscellaneous15964
  1540. Node: Breakpoints18618
  1541. Node: Views21282
  1542. Node: Evaluation22705
  1543. Node: Printing28339
  1544. Node: The Outside Context30369
  1545. Node: Just Checking32162
  1546. Node: Outside Window Configuration33655
  1547. Node: Recursive Edit37124
  1548. Node: Side Effects38161
  1549. Node: Macro Calls39737
  1550. Node: Options48164
  1551. Node: Todo List51350
  1552. Node: Index55262
  1553. 
  1554. End Tag Table
  1555.